GtkGrid: Add forgotten RTL flipping
authorMatthias Clasen <mclasen@redhat.com>
Wed, 30 Mar 2011 06:24:00 +0000 (02:24 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 30 Mar 2011 12:19:30 +0000 (08:19 -0400)
How did we manage to add a non-RTL savy container in GTK+ 3.0 ?

gtk/gtkgrid.c
tests/testgrid.c

index 4719857944d37a7528d452de669fbb1674ebd823..440b4d54000e51bd5aade9ffa76ec6378dab7832 100644 (file)
@@ -1195,6 +1195,10 @@ gtk_grid_request_allocate_children (GtkGridRequest *request)
       child_allocation.width = MAX (1, width);
       child_allocation.height = MAX (1, height);
 
+      if (gtk_widget_get_direction (GTK_WIDGET (request->grid)) == GTK_TEXT_DIR_RTL)
+        child_allocation.x = allocation.x + allocation.width
+                             - (child_allocation.x - allocation.x) - child_allocation.width;
+
       gtk_widget_size_allocate (child->widget, &child_allocation);
     }
 }
index a59aefeee9c3a6f2caad9f5f203b958d85ff8596..f9e85bb99c6418de8932ac6a7a8178df46a50fc8 100644 (file)
@@ -252,6 +252,9 @@ main (int argc, char *argv[])
 {
   gtk_init (NULL, NULL);
 
+  if (g_getenv ("RTL"))
+    gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
+
   simple_grid ();
   text_grid ();
   box_comparison ();